CC= g++
SHELL= /bin/sh

OBJ= service_app.o config.o xhead.o equeue.o ciqueue.o utils.o

MAIN= ciqueue
TEST= client

VERINFO= -DPROJNAME="\"$(MAIN)\"" -DVERSION="\"$(MAIN) 0.0.0.1\""

INCS= -I ../utils/mylog/include/ \
	  -I ../utils/filelinkblock/include/ \
	  -I ../utils/MyException/include/ \
	  -I ../opensrc/jsoncpp/include/ \

LDFLAGS= -L ../opensrc/jsoncpp/lib/   -ljson \
		 -L ../utils/filelinkblock/lib/  -lfilelinkblock \
		 -L ../utils/creat_sign/lib/  -lcreat_sign \
		 -L ../utils/mylog/lib/       -lmylog \
		 -L ../utils/MyException/lib/ -lMyException \

CPPFLAGS= $(DEBUG) $(INCS) $(VERINFO) -g  -pipe  -W -Wall -Wshadow -Wreturn-type \
		  -Wtrigraphs -Wformat -Wparentheses -Wpointer-arith  -Werror

all: client $(MAIN) 
	rm *.o -rf

$(MAIN): $(OBJ) 
	$(CC) -o $@ $^ $(LDFLAGS) -lpthread
	rm -rf bin/ log/
	mkdir log bin
	mv $(MAIN) bin/ -f
	mv $(TEST) bin/ -f

%.o: %.cpp %.h
	$(CC) $(CPPFLAGS) $< -c -o $@

clean:
	rm *.o -rf
	rm $(MAIN) -rf
	rm $(TEST) -rf
	rm -rf bin/ log/

client:
	g++ client.cpp xhead.cpp -o $(TEST) $(CPPFLAGS) -L ../utils/mylog/ -lmylog -L ../utils/MyException/lib/ -lMyException
